﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>对元素属性进行移除</title>
    <script src="jquery.min.js"></script>
    <script>
        $(document).ready(function () {
            $("button").click(function () {
                $("p").removeAttr("id class");
            });
        });
    </script>
    <style type="text/css">
        #p1 {
            color: white;
            background-color: green;
            font-size: 20px;
            padding: 5px;
        }

        .blue {
            color: white;
            background-color: blue;
            font-size: 20px;
            padding: 5px;
        }
    </style>
</head>
<body>
    <h1>静夜思</h1>
    <p id="p1">床前明月光，</p>
    <p class="blue">疑是地上霜。</p>
    <button>移除所有P元素的属性</button>
</body>
</html>